﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TechTalk.SpecFlow;
using RaygunDiplomacy.Entities;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace RaygunDiplomacy.EntitiesSpecification.StepDefinitions
{
   [Binding]
   public class StatisticsStepDefinition
   {
      Statistic testStatistic;

      [Given(@"I have a statistic named (.*)")]
      public void GivenIHaveAStatisticNamed(string name)
      {
         testStatistic = new Statistic();
         testStatistic.Name = name;
      }

      [Given(@"its base value is set to (.*)")]
      public void GivenItsBaseValueIsSetTo(float value)
      {
         testStatistic.BaseValue = value;
      }

      [When(@"a statistic source is not added to it")]
      public void WhenAStatisticSourceISNotAddedToIt()
      {
         // Do nothing
      }

      [When(@"a statistic source named (.*) is added to it with a value of (.*)")]
      public void WhenAStatisticSourceIsAddedToItWithAdValueOf(string name, float value)
      {
         testStatistic.AddValueSource(new StatisticSource(name, value));
      }

      [Then(@"the computed value should be (.*)")]
      public void ThenTheComputedValueShouldBe(float value)
      {
         Assert.AreEqual(value, testStatistic.Value);
      }
   }
}
